package com.shixulin.controller;

import com.shixulin.oss.handleFile;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.shixulin.domain.ResponseResult;
import com.shixulin.entity.Teacher;
import com.shixulin.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/teacher")
@CrossOrigin
public class TeacherController {
    @Autowired
    private TeacherService teacherService;

    @PostMapping("/login")
    public ResponseResult login(@RequestBody Teacher teacher) {
        System.out.println(teacher.getUsername()+"访问了");
        return teacherService.login(teacher);
    }
    @PostMapping("/getInfo/{username}")
    public ResponseResult getInfo(@PathVariable("username") String username){
        return teacherService.getInfo(username);
    }

    @PostMapping("/changePassword")
    public ResponseResult changePassword(@RequestBody Teacher teacher){
        return teacherService.changePassword(teacher);
    }

}
